<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="shortcut icon" href="__STATIC__/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="__STATIC__/css/font.css">
    <link rel="stylesheet" href="__STATIC__/css/xadmin.css">
    <script type="text/javascript" src="__STATIC__/js/jquery2.0.js"></script>
    <script type="text/javascript" src="__STATIC__/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="__STATIC__/js/xadmin.js"></script>
</head>

<body>

<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
    <ul class="layui-tab-title">
        <li class="layui-this">关注时回复</li>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <form class="layui-form" id="form1">
                <div class="layui-form-item">
                    <label class="layui-form-label">
                        <span class="x-red">*</span>回复类型
                    </label>
                    <div class="layui-input-inline">
                        <select name="re_state">
                            {if $data.re_state eq 0}
                                <option value="0">文字</option>
                                <option value="1">图文</option>
                            {else/}
                                <option value="1">图文</option>
                                <option value="0">文字</option>
                            {/if}
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label  class="layui-form-label">
                        <span class="x-red">*</span>标题
                    </label>
                    <div class="layui-input-inline">
                        <input type="text"  name="re_title"
                               autocomplete="off" class="layui-input" value="{$data.re_title}">
                    </div>
                </div>
                <div class="layui-form-item" id="img1">
                    <label  class="layui-form-label">
                        <span class="x-red">*</span>logo
                    </label>
                    <button type="button" class="layui-btn" id="image1">
                        <i class="layui-icon">&#xe67c;</i>选择图片
                    </button>
                    {if $data.re_image eq null}
                        <input class='shop_image' value="" name='re_image'type='hidden'>
                    {else/}
                        <img src="{$data.re_image}" style='float: left;width:100px;max-height: 60px;' alt='...'>
                        <input class='shop_image' value="{$data.re_image}" name='re_image'type='hidden'>
                    {/if}
                </div>
                <div class="layui-form-item">
                    <label  class="layui-form-label">
                        <span class="x-red">*</span>跳转链接
                    </label>
                    <div class="layui-input-inline">
                        <input type="text"  name="re_url"
                               autocomplete="off" class="layui-input" value="{$data.re_url}">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">简介</label>
                    <div class="layui-input-block">
                    <textarea id="textbb" style="width:400px;height:300px;" name="re_remark" placeholder="请输入内容"
                              class="layui-textarea">{$data.re_remark}</textarea>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">
                    </label>
                    <button class="layui-btn" lay-filter="add" lay-submit="">
                        保存
                    </button>
                </div>
            </form>
        </div>
    </div>
</div>
<script type="text/javascript">
    layui.use(['form','upload', 'layer'], function () {
        $ = layui.jquery;
        var form = layui.form
            ,upload = layui.upload
            , layer = layui.layer;

        var uploadInst = upload.render({
            elem: '#image1' //绑定元素
            ,url: '{:url("index/shopImage")}' //上传接口
            ,done: function(res){
                $('#img1').children("img").remove();
                $('#img1').children(".shop_image").remove();
                $('#img1').append("<img src='"+res.url+"' style='float: left;width:100px;max-height: 60px;' alt='...'>");
                $('#img1').append("<input class='shop_image' value='"+res.url+"'name='re_image'type='hidden'>");
            }
            ,error: function(){
                //请求异常回调
            }
        });
        var uploadInst = upload.render({
            elem: '#image2' //绑定元素
            ,url: '{:url("index/shopImage")}' //上传接口
            ,done: function(res){
                $('#img2').children("img").remove();
                $('#img2').children(".shop_image").remove();
                $('#img2').append("<img src='"+res.url+"' style='float: left;width:100px;max-height: 60px;' alt='...'>");
                $('#img2').append("<input class='shop_image' value='"+res.url+"'name='wx_qrcode'type='hidden'>");
            }
            ,error: function(){
                //请求异常回调
            }
        });

        //监听提交
        form.on('submit(add)', function (data) {
            //
            $.post('{:url("wxpage/reponsemsg")}',data.field,function (res) {
                if (res==true){
                    layer.msg("保存成功！", {icon: 6,time:1000}, function () {
                        window.location.reload();
                    });
                }else {
                    layer.msg("保存失败！", {icon: 5,time:1000});
                }
            });
            return false;
        });
    });
</script>
</body>

</html>
